<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:doc="livcos.org/ns/doc"
  xmlns="http://www.w3.org/1999/xhtml"
  exclude-result-prefixes="doc">

  <xsl:param name="incl-chapter_numbering" select="'1'"/>

  <xsl:template match="doc:chapter">
    <div id="{@id}">
      <xsl:element name="h{count(ancestor::doc:chapter)+1}">
				<xsl:if test="$incl-chapter_numbering = '1'">
					<xsl:number level="multiple" count="doc:chapter" format="1.1"/>
					<xsl:text>&#160;</xsl:text>
				</xsl:if>
				<span class="inlineEdit" title="title">
					<xsl:apply-templates select="doc:title/node()"/>
				</span>
      </xsl:element>
      <xsl:apply-templates select="* except doc:title"/>
    </div>
  </xsl:template>

  <xsl:template match="doc:paragraph">
  	<p id="{@id}" class="inlineEdit"><xsl:apply-templates/></p>
  </xsl:template>

  <xsl:template match="doc:subject">
    <div id="{@id}" class="subject">
      <div class="title">
        <xsl:apply-templates select="doc:title/node()"/>
      </div>
      <div class="content">
        <xsl:apply-templates select="doc:content/node()"/>
      </div>
    </div>
  </xsl:template>

</xsl:stylesheet>
